using System.Collections.Generic;
using WindsorContainer.DataAccess;
using WindsorContainer.Domain;

namespace WindsorContainer.Service
{
    public class CustomerService : ICustomerService
    {
        private IRepository<Customer> inner;

        public CustomerService(IRepository<Customer> inner)
        {
            this.inner = inner;
            InitializeDataStore();
        }

        private void InitializeDataStore()
        {
            inner.DataStore = new List<Customer>();
            inner.DataStore.Add(new Customer(1, "Douglas", "Adams"));
            inner.DataStore.Add(new Customer(2, "Arthur", "Dent"));
            inner.DataStore.Add(new Customer(3, "Ford", "Prefect"));
            inner.DataStore.Add(new Customer(4, "Zaphod", "Beeblebrox"));
            inner.DataStore.Add(new Customer(5, "Trillian", ""));
            inner.DataStore.Add(new Customer(6, "Marvin", ""));
            inner.DataStore.Add(new Customer(7, "Slartibartfast", ""));
        }

        public Customer FindCustomerById(int id)
        {
            return inner.Get(id);
        }
    }
}
